package com.rising.threads.condition;

/**
 * @Author: rising
 * @Description:
 * @Date: create in 2021/1/7 22:47
 */
public class MainTest {
    public static void main(String[] args) {
        ShareData shareData = new ShareData();

        new Thread(() -> {
            for (int i = 1; i <=5; i++){
                try {
                    shareData.producer();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "AA").start();

        new Thread(() -> {
            for (int i = 1; i <=5; i++){
                try {
                    shareData.consumer();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "BB").start();

        new Thread(() -> {
            for (int i = 1; i <=5; i++){
                try {
                    shareData.producer();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "CC").start();

        new Thread(() -> {
            for (int i = 1; i <=5; i++){
                try {
                    shareData.consumer();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "DD").start();
    }
}
